package com.learning.spring.cloud.alibaba.ribbon.loadbalanced.web.service;

import com.learning.spring.cloud.alibaba.ribbon.loadbalanced.web.mapper.UserMapper;
import com.learning.spring.cloud.alibaba.ribbon.loadbalanced.web.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * ClassName: UserServiceImpl
 * Description:
 * Date: 2021/7/25 23:00 【需求编号】
 *
 * @author Sam Sho
 * @version V1.0.0
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class UserServiceImpl implements IUserService {

    @Autowired
    private UserMapper userMapper;


    @Override
    public int insert(User record) {
        return userMapper.insert(record);
    }

    @Override
    public int deleteByPrimaryKey(Long id) {
        return userMapper.deleteByPrimaryKey(id);
    }

    @Override
    @Transactional(readOnly = true)
    public User selectByPrimaryKey(Long id) {
        return userMapper.selectByPrimaryKey(id);
    }
}
